---触发器，继承触发器可以实现自己数据监听来造成对状态的变更，以达到更新Goal的目的
---@class TriggerBase
---@field priority number   优先级
---@field effects State 造成影响
---@field agent AgentBase   代理
TriggerBase = class()

---@param agent AgentBase
function TriggerBase:ctor(agent)
    self.agent = agent;
    self.effects = self:InitEffects();
end

---初始化影响，子类重写
function TriggerBase:InitEffects()
    local state = State.new();
    return state;
end

---判断是否满足触发条件，子类重写
function TriggerBase:IsTrigger()
    return false;
end

---帧函数
function TriggerBase:FrameFun()
    if self:IsTrigger() then
        self.agent.agentState:SetByOther(self.effects);
    end
end

---获取游戏数据
---@param key string
function TriggerBase:GetGameData(key)
    return self.agent.dataMap:GetGameData(key);
end

---设置游戏数据
function TriggerBase:SetGameData(key, value)
    self.agent.dataMap:SetGameData(key,value);
end

function TriggerBase:Release()

end